import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Test1 {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
                3,10,1, TimeUnit.SECONDS,
                new LinkedBlockingDeque<>(5), new ThreadPoolExecutor.AbortPolicy()
        );
        for (int i = 0; i < 100; i++) {
            int taskId = i + 1;
            threadPoolExecutor.submit(() -> {
                System.out.println("执行任务：" + taskId + ", " + Thread.currentThread().getName());
            });
        }
    }
}
